<script setup lang="ts">
import '@/assets/css/global.css'
import { useApiDetialStore } from '@/stores';
const { clickCard } = useApiDetialStore()
// 传来的数据
const { apiInfo } = defineProps(['apiInfo'])
</script>
<template>
  <div @click="clickCard(apiInfo)">
    <el-card class="api-item" shadow="hover">
      <template #header>
        <div class="card-header" style="display: flex;align-items: center; justify-content: space-between;">
          <span style="font-size: 1.17em;font-weight: bold;">{{ apiInfo.name }}</span>
          <el-tag type="success" effect="light" size="large" round>
            {{ apiInfo.method }}
          </el-tag>
        </div>
      </template>
      <div class="api-item-content">
        <!-- 描述信息 -->
        <div class="flex_base api-item-descript " style="font-size: 1em;">{{ apiInfo.description }}</div>
        <!-- 用户信息 数量 -->
        <div class="api-item-author flex_base">
          <div class="flex_base">
            <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
            <span class="flex_base" style="margin-left: 10px;font-size: 0.8em;">{{ apiInfo.userNickName }}</span>
          </div>
          <div class="flex_base">
            <div style="color: rgb(244, 70, 165);margin-right:5px;">❤ {{ 5 }}k</div>
          </div>
        </div>
        <!-- 星级推荐 -->
        <div class="api-item-start flex_base">
          <el-rate v-model="apiInfo.score" disabled text-color="#ff9900" />
        </div>
      </div>
    </el-card>
  </div>

</template>

<style scoped>
.el-card__header {
  border-bottom: 0px;
}

.el-card {
  --el-card-border-color: 0px;
}

.api-item {
  width: 280px;
  height: 210px;
  border-radius: 18px;
  /* background-color: rgb(244, 70, 165); */
  background-image: linear-gradient(to bottom, rgb(185, 242, 254), rgb(226, 236, 245));
}

.api-item-content {
  width: 240px;
  margin-top: -35px;
  border-radius: 20px;
  /* border: 1px solid rgb(228, 14, 14); */
  /* background-color: green; */
}

.api-item-descript {
  margin: 10px;
  height: 60px;
  font-size: 1.1em;
  justify-content: space-evenly;
}

.api-item-author {
  margin-top: 0px;
  justify-content: space-between;
}

.api-item-start {
  height: 40px;
  justify-content: center;
}
</style>